<?PHP
	class File {
		function getSize($size){
			$sizes = array("bytes","Kb","Mb","Gb","Tb");
			$sizeCount = 0;
			$newsize = $size;
			while($newsize>1024){
				$newsize = $newsize/1024;
				$sizeCount++;
			}
			return ceil($newsize)." ".$sizes[$sizeCount];
		}
		function throwFile($filename,$filecontent){
			header("Content-type: application/octet-stream");
			header("Content-Disposition: attachment; filename=\"$filename\"");
			echo $filecontent;
		}
		function zipFiles($zipname,$files){
			$zipfile = new zipfile();
//	        $zipfile->add_dir("files/");
			for($f=0;$f<count($files);$f++){
				$filename = $files[$f][0];
				$filedata = $files[$f][1];
        		$zipfile->add_file($filedata, $filename);
			}
			File::throwFile($zipname,$zipfile->file());
		}
		function getFile($actualfile,$newname){
			$fcontent = implode("",file($actualfile));
			File::throwFile($newname,$fcontent);
		}
	}
?>